<!DOCTYPE html>
<html>
{include file="sunfc/public/headfile" /}
<body>

<div class="layui-fluid" id="app">

    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">

            <div class="layui-card">

                <div class="layui-card-body">


                        <div class="layui-card-body" style="padding: 15px;">

                            <div class="layui-form-item layui-form-text">
                                <label class="layui-form-label">排序</label>
                                <div class="layui-input-block">
                                    <input id="sort" type="text" value="{$item.sort}"  class="layui-input">
                                    <input id="hidesort" type="hidden" value="{$item.sort}"  class="layui-input">
                                    <input id="uid" type="hidden" value="{$item.id}"  class="layui-input">
                                </div>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <div class="layui-input-block">
                                <button class="layui-btn">保存</button>
                            </div>
                        </div>

                </div>


            </div>
        </div>
    </div>

</div>
</body>
<script>
    var app = new Vue({
        el: '#app',
        data: {
            check: [],
            curr: 1,//当前页
            limit: 10,//当前页
            items: []
        }
    });

    function init() {
        layer.ready(function () {
            layer.load(2);
            $.get('/admin/sunfc.help/index', {page: app.curr, limit: app.limit},
                function (res) {
                    layer.closeAll();
                    app.items = res.data;
                }
            );
        });

    }

    layui.use(['table','laypage', 'layer'], function () {

        $('.layui-btn').click(function () {
            var sort1 = $('#sort').val();
            var sort2 = $('#hidesort').val();
            if(sort1==sort2){
                    parent.layer.closeAll();

            }else {
                var uid = $('#uid').val();
                var new_sort = $('#sort').val();
                $.post('{:url("sortEdit")}', {id: uid,sort:new_sort}, function (res) {
                    if (res.code == 1){
                        layer.msg(res.msg, {icon: 1});
                        setTimeout(function(){  parent.layer.closeAll(); }, 1000);
                    }else {
                        layer.msg(res.msg);
                        parent.layer.closeAll();
                    }

                });
            }
        })
    })
</script>
</html>










